<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>现代小区管家物业后台管理系统</title>
    <#assign base=request.contextPath/>
    <link rel="stylesheet" href="${base}/frame/layui/css/layui.css">
    <link rel="stylesheet" href="${base}/frame/static/css/style.css">
    <link rel="icon" href="${base}/frame/static/image/code.png">
    <script src="${base}/js/jquery.min.js"></script>
    <style type="text/css">

        html .skin-0 .dblclick-tips-box i.layui-layer-TipsB {
            border-right-color: #393D49;
        }

        html .skin-0 .dblclick-tips-box .layui-layer-content {
            background-color: #393D49;
        }

        .layui-table-cell {
            height: auto;
            line-height: 28px;
        }

    </style>
</head>
<body>
<script>
    //控制跳出ifream框架
    if (window != top)
        top.location.href = location.href;
</script>
<!-- layout admin -->
<div class="layui-layout-admin">
    <!-- header -->
    <div class="layui-header my-header">
    <#-- 	<img style="height: 60px;margin-left: 150px;" src="${base}/img/system.jpg"/>-->
        <a href="index.html">
            <div class="my-header-logo" style="font-size: 16px;color: #c1c2c6;">
                <i class="layui-icon layui-icon-util" style="font-size: 25px; color: white;">现代小区管家物业后台管理系统 </i>
            </div>
        </a>
        <!-- 顶部右侧添加选项卡监听 -->
        <ul class="layui-nav my-header-user-nav" lay-filter="side-top-right" style="margin-right: 130px;">
            <li class="layui-nav-item"><a href="javascript:;" class="pay" href-url=""><span id="logInfo"></span></a>
            </li>
            <li class="layui-nav-item">
                <a class="name" href="javascript:;">
                    <i class="layui-icon layui-icon-friends" style="font-size: 20px; color: white;"></i>
                <span style="font-size: 20px; color: white;">${userInfo.username}</span>
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:;" href-url="${base}/admin/userInfo/password.html">修改密码</a></dd>
                    <hr>
                    <dd><a href="${base}/admin/userInfo/login.html">退出系统</a></dd>
                </dl>

            </li>
        <#--<li>-->
        <#--<dl class="layui-nav-child">-->
        <#--<dd><a href="${base}/admin/userInfo/login.html"><i class="layui-icon">&#x1006;</i>登出</a></dd>-->
        <#--&lt;#&ndash;<dd><a href="${base}/admin/userInfo/password.html"><i class="layui-icon">&#x1006;</i>修改密码</a></dd>&ndash;&gt;-->
        <#--</dl>-->
        <#--</li>-->
            </li>
        </ul>
    </div>
    <!-- side -->
    <div class="layui-side my-side">
        <div class="layui-side-scroll">
            <!-- 左侧主菜单添加选项卡监听 -->
            <ul class="layui-nav layui-nav-tree" lay-filter="side-main" id="nav_list">
            <#--<li class="layui-nav-item">-->
            <#--<a href="javascript:;"><i class="layui-icon">&#xe613;</i>用户</a>-->
            <#--<dl class="layui-nav-child">-->
            <#--<dd><a href="javascript:;" href-url="${base}/admin/userInfo/user.html"><i class="layui-icon"></i>用户列表</a>-->
            <#--</dd>-->
            <#--</dl>-->
            <#--</li>-->


            </ul>
        </div>
    </div>

    <!-- 欢迎页 -->
    <div class="layui-body my-body">
        <div class="layui-tab layui-tab-card my-tab" lay-filter="card" lay-allowClose="true">
            <ul class="layui-tab-title">
                <li class="layui-this" lay-id="1"><span><i class="layui-icon">&#xe638;首页</i> </span></li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <iframe id="iframe" src="${base}/admin/userInfo/user.html" frameborder="0"></iframe>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- pay -->

<!-- 右键菜单 -->
<div class="my-dblclick-box none">
    <table class="layui-tab dblclick-tab">
        <tr class="card-refresh">
            <td><i class="layui-icon">&#x1002;</i>刷新当前标签</td>
        </tr>
        <tr class="card-close">
            <td><i class="layui-icon">&#x1006;</i>关闭当前标签</td>
        </tr>
        <tr class="card-close-all">
            <td><i class="layui-icon">&#x1006;</i>关闭所有标签</td>
        </tr>
    </table>
</div>


<script type="text/javascript" src="${base}/frame/layui/layui.js"></script>
<script type="text/javascript" src="${base}/frame/static/js/vip_comm.js"></script>
<script language="javascript">

    function getCurDate() {
        var d = new Date();
        var week;
        switch (d.getDay()) {
            case 1:
                week = "星期一";
                break;
            case 2:
                week = "星期二";
                break;
            case 3:
                week = "星期三";
                break;
            case 4:
                week = "星期四";
                break;
            case 5:
                week = "星期五";
                break;
            case 6:
                week = "星期六";
                break;
            default:
                week = "星期天";
        }
        var years = d.getFullYear();
        var month = add_zero(d.getMonth() + 1);
        var days = add_zero(d.getDate());
        var hours = add_zero(d.getHours());
        var minutes = add_zero(d.getMinutes());
        var seconds = add_zero(d.getSeconds());
        var ndate = years + "年" + month + "月" + days + "日 " + hours + ":" + minutes + ":" + seconds + " " + week;
        var divT = document.getElementById("logInfo");
        divT.innerHTML = ndate;
    }

    function add_zero(temp) {
        if (temp < 10) return "0" + temp;
        else return temp;
    }

    setInterval("getCurDate()", 100);
</script>
<script>
    $.ajax({
        type: "POST", //提交方式
        url: "${base}/admin/menu/findMenu",//路径
        data: {username: $("#username").val(), password: $("#password").val()},
        async: false,
        success: function (data) {//返回数据根据结果进行相应的处理
            data = JSON.stringify(data);
            //把后台查出的用户所有信息转成json对象  包括用户角色 和角色所拥有的菜单
            var dataJson = JSON.parse(data);
            //右上角角色
            /*$("#roleId").append(dataJson.roles.roleName+"："+dataJson.username);*/
            //获取该角色的所有菜单
            var menu = dataJson.roles.menus;
            //alert("menu:"+JSON.stringify(menu))
            var pantid = [];
            var htm;
            for (var i = 0; i < menu.length; i++) {
                //alert(JSON.stringify(menu[i]))
                //如果是父节点
                if (menu[i].menuLev == 1) {
                    $("#nav_list").append(
                            '<li class="layui-nav-item">' +
                            '<a href="javascript:;"><i class="layui-icon">&#xe770;</i>' + menu[i].menuName + '</a>' +
                            '<dl class="layui-nav-child" id="' + menu[i].id + '">' +
                            '</dl>' +
                            '</li>'
                    );
                    pantid.push(menu[i].id);
                }
            }
            //循环所有菜单
            for (var j = 0; j < menu.length; j++) {
                //循环所有父节点ID数组
                for (var k = 0; k < pantid.length; k++) {
                    //如果该次父节点循环 是该次菜单的 父节点
                    if (pantid[k] == menu[j].parentId) {
                        htm = document.getElementById(pantid[k]).innerHTML;
                        htm = htm + '<dd><a href="javascript:;" target="_top" href-url="${base}' + menu[j].menuUrl + '" title="' + menu[j].menuName + '" class="iframeurl"><i class="layui-icon"></i>' + menu[j].menuName + '</a></dd>'
                        document.getElementById(pantid[k]).innerHTML = htm;
                    }
                }
            }

        }
    });
</script>
</body>
</html>